package com.cqeec.myblog.junitTest;

import org.junit.jupiter.api.Test;

import com.sun.org.apache.bcel.internal.generic.NEWARRAY;

public class ArrayTest {

	@Test
	public void arrayCopyTest() {
		//老数组
		String[] old_1=new String[3];
			old_1[0]="1_1";
			old_1[1]="2_1";
			old_1[2]="2_1";
		String[] old_2=new String[2];	
			old_2[0]="1_2";
			old_2[1]="2_2";
		//新数组
		String[] new_arr=new String[old_1.length+old_2.length];
		System.arraycopy(old_1, 0, new_arr, 0, old_1.length);
    	System.arraycopy(old_2, 0, new_arr, old_1.length, old_2.length);
		for(String tmep:new_arr) {
			System.out.println(tmep);
		}
    	System.out.println(new_arr.toString());
	}
	
}
